<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <!--[if lt IE 9]>
    <script type="text/javascript" src="../../lib/html5shiv.js?rev=@@hash"></script>
    <script type="text/javascript" src="../../lib/respond.min.js?rev=@@hash"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="../../static/h-ui/css/H-ui.min.css"/>
    <link rel="stylesheet" type="text/css" href="../../static/h-ui.admin/css/H-ui.admin.css"/>
    <link rel="stylesheet" type="text/css" href="../../lib/Hui-iconfont/1.0.8/iconfont.css"/>
    <link rel="stylesheet" type="text/css" href="../../static/h-ui.admin/skin/default/skin.css" id="skin"/>
    <link rel="stylesheet" type="text/css" href="../../static/h-ui.admin/css/style.css"/>
    <link rel="stylesheet" type="text/css" href="../../ht-css/Project.css"/>
    <!--[if IE 6]>
    <script type="text/javascript" src="../../lib/DD_belatedPNG_0.0.8a-min.js?rev=@@hash"></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="../../ht-css/style-q.css"/>
    <link rel="stylesheet" type="text/css" href="../../ht-css/custom.css"/>
    <link rel="stylesheet" type="text/css" href="../../ht-css/combo.select.css"/>
    <title>导出</title>
    <style>
        td {
            vertical-align: text-top
        }

        .down-5 {
            position: relative;
            top: 5px;
        }

        /*option{display: none}*/
        /*#custArea{padding:5px 10px;display: inline-block;}*/
        /*#custName{padding:5px 10px;display: inline-block;}*/
        /*#topicName{padding:5px 10px;display: inline-block;}*/
        /*#sendCouponDept{padding:5px 10px;display: inline-block;}*/
        /*#sendCouponUser{padding:5px 10px;display: inline-block;}*/
        /*#sendCouponReason{padding:5px 10px;display: inline-block;}*/
    </style>
</head>
<body>
<div class="text-c mb-30">导出设置</div>
<table cellspacing="0" cellpadding="0" style="margin: 0 auto;width: 500px;" class="putouttable">
    <tr>
        <td class="f-r mr-30 down-5">客户范围</td>
        <td style="width: 400px;"><label><input type="radio" name="custArea" checked="checked" onclick="undownload(1)">
            不限</label>
            <div class="mb-10 mt-5"><label><input type="radio" name="custArea" id="radio-custArea" onclick="download()">
                <select name="" id="custArea" style="width: 100px;display: inline-block" onchange="download(1)">
                    <option value="" selected>选择区域</option>
                </select>
                <select name="" id="custType" style="width: 100px;display: inline-block" onchange="download(1)">
                    <option value="" selected>选择客户类型</option>
                    <option value="11">签约客户(非分销)</option>
                    <option value="12">签约客户(分销)</option>
                    <option value="20">普通客户</option>
                    <option value="30">认证客户</option>
                </select>
                <input type="text" id="custName" onkeyup="download(1)" class="input-text radius wd-150" name=""
                       placeholder="输入名称关键字">
                <!--<select name="custName" id="custName" onchange="selectArea()" style="width: 200px;display: inline-block">
                    <option value="" selected>输入关键字选择客户</option>
                </select>--></label>
                <!--<ul id="custList" class=" hide" style="position:absolute;left:245px;background: #ffffff;width: 195px;border: 1px solid #999;border-radius: 2px">-->

                </ul></div>
        </td>
    </tr>
    <tr>
        <td class="f-r mr-30 down-5">电子券范围</td>
        <td><label><input type="radio" name="coupontopic" checked="checked" onclick="undownload(2)">不限</label>
            <div class="mb-10 mt-5"><label><input type="radio" name="coupontopic" id="radio-couponTopic"
                                                  onclick="download()">
                <span>电子券主题：</span><input type="text" id="topicName" class="input-text radius wd-150" name=""
                                          placeholder="输入主题关键字" onchange="download(2)">
                <!-- <select name="" id="topicName" onchange="selectArea()" style="width: 200px;display: inline-block">
                     <option value="" selected>输入关键字选择发券主题</option>
                 </select>--></label></div>
        </td>
    </tr>
    <tr>
        <td class="f-r mr-30 down-5">发放范围</td>
        <td><label><input type="radio" name="sendArea" checked="checked" onclick="undownload(3)">不限</label>
            <div class="mb-10 mt-5"><label><input type="radio" name="sendArea" id="radio-sendArea" onclick="download()">
                <div style="display: inline-block" class="mb-15"><span>发券部门：</span><input onchange="download(3)"
                                                                                          type="text"
                                                                                          id="sendCouponDept"
                                                                                          class="input-text radius wd-150"
                                                                                          name="" placeholder="输入部门关键字">
                    <!--<select name="" id="sendCouponDept" onchange="selectArea()" style="width: 240px;display: inline-block">
                        <option value="" selected>输入部门关键字选择发券部门</option>
                    </select>--></div>
                <div class="ml-15 mb-15"><span class="mr-15">发券人：</span><input type="text" id="sendCouponUser"
                                                                               class="input-text radius wd-150" name=""
                                                                               onchange="download(3)"
                                                                               placeholder="输入关键字">
                    <!--<select name="" id="sendCouponUser" onchange="selectArea()" style="width: 200px;display: inline-block">
                        <option value="" selected>输入关键字选择发券人</option>
                    </select>--></div>
                <div class="ml-15"><span class="f-l">发券原因：</span>
                    <div class="   col-xs-8 " style="width:30%">
                        <select class="select f-l" size="1" name="sendReasonDutyDept" id="sendReasonDutyDept"
                                onchange="sendDeptChange(value)">
                            <option value="" selected>选择责任部门</option>
                            <option value="1">商品问题</option>
                            <option value="2">仓储/物流问题</option>
                            <option value="3">财务问题</option>
                            <option value="4">网站运营问题</option>
                            <option value="5">服务体验问题</option>
                            <option value="6">运费问题</option>
                            <option value="7">技术问题</option>
                        </select>
                    </div>
                    <div class="   col-xs-8 " style="width:30%">
                        <select class="select f-l" size="1" name="sendCouponReason" id="sendCouponReason"
                                onchange="download(3)">
                            <option value="" selected>选择具体原因</option>
                            <option class="options hide" value="11">质量问题</option>
                            <option class="options hide" value="12">无货问题</option>
                            <option class="options hide" value="21">配送延迟</option>
                            <option class="options hide" value="22">状态维护错误</option>
                            <option class="options hide" value="23">私自拒收</option>
                            <option class="options hide" value="24">包装/商品破损</option>
                            <option class="options hide" value="25">违规收费</option>
                            <option class="options hide" value="26">服务态度差</option>
                            <option class="options hide" value="27">错漏发</option>
                            <option class="options hide" value="31">退款时效慢</option>
                            <option class="options hide" value="32">开票信息有误</option>
                            <option class="options hide" value="33">退款金额有误</option>
                            <option class="options hide" value="34">开具发票时间有误</option>
                            <option class="options hide" value="41">商品参数错误</option>
                            <option class="options hide" value="42">价格错误</option>
                            <option class="options hide" value="43">活动与实际不符</option>
                            <option class="options hide" value="44">活动优惠券补发</option>
                            <option class="options hide" value="45">活动优惠券发放</option>
                            <option class="options hide" value="51">特殊售后问题</option>
                            <option class="options hide" value="52">提升客户体验</option>
                            <option class="options hide" value="53">承诺错误</option>
                            <option class="options hide" value="54">售后时间长</option>
                            <option class="options hide" value="61">售后运费补偿</option>
                            <option class="options hide" value="62">错发运费补偿</option>
                            <option class="options hide" value="71">订单未流转</option>
                            <option class="options hide" value="72">活动未绑定优惠品、赠品</option>
                            <option class="options hide" value="73">系统自动取消</option>
                            <option class="options hide" value="74">页面缓存问题</option>
                        </select>
                    </div>
                </div>
                <div class="ml-15 mb-15 f-l mt-15">
                    <label class="f-l">发券方式：</label>
                    <select id="sendCouponType" style="width:60%" class="select f-l" size="1" onchange="download(3)">
                        <option value="" selected>选择发券方式</option>
                        <option value="1">手动发券</option>
                        <option value="2">自动发券</option>
                        <option value="3">客户领取</option>
                    </select>
                </div>
                <div class="ml-15 mb-15 f-l mt-15"><span>发放时间：</span>
                    <input type="text" onfocus="WdatePicker({
                maxDate:'#F{$dp.$D(\'logmax\')||\'%y-%M-%d\'}',startDate:'%y-%M-01 00:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss'})"
                           id="logmin" class="input-text Wdate radius" style="width:120px;" onchange="download(3)"
                           placeholder="请选择时间" autocomplete="off">
                    <input type="text" onfocus="WdatePicker({
                minDate:'#F{$dp.$D(\'logmin\')}',dateFmt:'yyyy-MM-dd HH:mm:ss'})" id="logmax"
                           class="input-text Wdate radius ml-15" style="width:120px;" placeholder="请选择时间"
                           onchange="download(3)" autocomplete="off"></div>
            </label></div>
        </td>
    </tr>
</table>
<div class="text-c pt-10 pb-10">
    <button class="btn radius size-S" onclick="cancel()">取消</button>
    <a class="btn btn-secondary radius size-S ml-10" id="putout" onclick="checkSubmit()">确认导出</a></div>
</body>
<script type="text/javascript" src="../../lib/jquery/1.9.1/jquery.min.js?rev=@@hash"></script>
<script type="text/javascript" src="../../lib/layer/2.4/layer.js?rev=@@hash"></script>
<script type="text/javascript" src="../../static/h-ui/js/H-ui.min.js?rev=@@hash"></script>
<script type="text/javascript" src="../../static/h-ui.admin/js/H-ui.admin.js?rev=@@hash"></script> <!--/_footer 作为公共模版分离出去-->
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="../../lib/My97DatePicker/4.8/WdatePicker.js?rev=@@hash"></script>
<!--表单验证-->
<script type="text/javascript" src="../../lib/jquery.validation/1.14.0/jquery.validate.js?rev=@@hash"></script>
<script type="text/javascript" src="../../lib/jquery.validation/1.14.0/validate-methods.js?rev=@@hash"></script>
<script type="text/javascript" src="../../lib/jquery.validation/1.14.0/messages_zh.js?rev=@@hash"></script>
<script type="text/javascript" src="../../lib/datatables/1.10.0/jquery.dataTables.min.js?rev=@@hash"></script>
<script type="text/javascript" src="../../lib/laypage/1.2/laypage.js?rev=@@hash"></script>
<script src="../../ht-js/public.js?rev=@@hash"></script>
<!--验证token-->
<script src="../../ht-js/verifyToken.js?rev=@@hash"></script>
<script src="../../ht-js/Project.js?rev=@@hash"></script>
<script src="../../ht-js/jquery.combo.select.js?rev=@@hash"></script>
<script src="../../ht-js/dynamicWarehouse.js?rev=@@hash"></script>
<script>
    $('#reset').click(function () {
        $('input').val('');
    })
    var custArea = $('#custArea').val();
    var custName = $('#custName').val();
    var custType = $('#custType').val();
    var topicName = $('#topicName').val();
    var sendCustType = $('#custType').val();
    var sendCouponDept = $('#sendCouponDept').val();
    var sendCouponUser = $('#sendCouponUser').val();
    var sendReasonDutyDept = $('#sendReasonDutyDept').val();
    var sendCouponReason = $('#sendCouponReason').val();
    var inputStarTime = $('#logmin').val();
    var inputEndTime = $('#logmax').val();
    var sendCouponType = $('#sendCouponType').val();

    function download(a) {
        switch (a) {
            case 1:
                $("#radio-custArea").attr("checked", 'checked');
                break;
            case 2:
                $("#radio-couponTopic").attr("checked", 'checked');
                break;
            case 3:
                $("#radio-sendArea").attr("checked", 'checked');
                break;
        }
        custArea = $('#custArea').val();
        custName = $('#custName').val();
        custType = $('#custType').val();
        topicName = $('#topicName').val();
        sendCustType = $('#custType').val();
        sendCouponDept = $('#sendCouponDept').val();
        sendCouponUser = $('#sendCouponUser').val();
        sendReasonDutyDept = $('#sendReasonDutyDept').val();
        sendCouponReason = $('#sendCouponReason').val();
        inputStarTime = $('#logmin').val();
        inputEndTime = $('#logmax').val();
        sendCouponType = $('#sendCouponType').val();
        if(sendCouponType=='' || sendCouponType==null){
            $('#putout').attr('href', root.couponInter.coupon_downloadCouponInfo + 'custName=' + '' + custName +
                '&custArea=' + '' + custArea + '' +'&sendCustType=' + '' + custType + '' + '&sendCouponDept=' + '' + sendCouponDept + '' + '&sendCouponUser=' + '' + sendCouponUser + '' + '&sendReasonDutyDept=' + '' + sendReasonDutyDept + '' + '&sendCouponReason=' + '' + sendCouponReason + '' + '&topicName=' + '' + topicName + '' + '&inputStarTime=' + '' + inputStarTime + '' + '&inputEndTime=' + '' + inputEndTime + '');
        }else{
            $('#putout').attr('href', root.couponInter.coupon_downloadCouponInfo + 'custName=' + '' + custName + '' +'&sendCouponType=' + '' + sendCouponType + '' +
                '&custArea=' + '' + custArea + '' +'&sendCustType=' + '' + custType + '' + '&sendCouponDept=' + '' + sendCouponDept + '' + '&sendCouponUser=' + '' + sendCouponUser + '' + '&sendReasonDutyDept=' + '' + sendReasonDutyDept + '' + '&sendCouponReason=' + '' + sendCouponReason + '' + '&topicName=' + '' + topicName + '' + '&inputStarTime=' + '' + inputStarTime + '' + '&inputEndTime=' + '' + inputEndTime + '');
        }
    }

    function undownload(b) {
        switch (b) {
            case 1:
                console.log(1);
                custArea = '';
                custName = '';
                custType = '';
                break;
            case 2:
                console.log(2);
                topicName = ''
                break;
            case 3:
                console.log(3);
                sendCouponDept = '';
                sendCouponUser = '';
                sendReasonDutyDept = '';
                sendCouponReason = '';
                inputStarTime = '';
                inputEndTime = '';
                break;
        }
        if(sendCouponType=='' || sendCouponType==null){
            $('#putout').attr('href', root.couponInter.coupon_downloadCouponInfo + 'custName=' + '' + custName + '' + '&custArea=' + '' + custArea + '' +'&sendCustType=' + '' + custType + '' + '&sendCouponDept=' + '' + sendCouponDept + '' + '&sendCouponUser=' + '' + sendCouponUser + '' + '&sendReasonDutyDept=' + '' + sendReasonDutyDept + '' + '&sendCouponReason=' + '' + sendCouponReason + ''
                + '&topicName=' + '' + topicName + '' + '&inputStarTime=' + '' + inputStarTime + '' + '&inputEndTime=' + '' + inputEndTime + '');
        }else{
            $('#putout').attr('href', root.couponInter.coupon_downloadCouponInfo + 'custName=' + '' + custName + '' + '&custArea=' + '' + custArea + '' +'&sendCustType=' + '' + custType + '' + '&sendCouponDept=' + '' + sendCouponDept + '' + '&sendCouponUser=' + '' + sendCouponUser + '' + '&sendReasonDutyDept=' + '' + sendReasonDutyDept + '' + '&sendCouponReason=' + '' + sendCouponReason + ''
                + '&sendCouponType=' + '' + sendCouponType + ''+ '&topicName=' + '' + topicName + '' + '&inputStarTime=' + '' + inputStarTime + '' + '&inputEndTime=' + '' + inputEndTime + '');
        }
    }

    function checkSubmit() {
        sendReasonDutyDept = $('#sendReasonDutyDept').val();
        sendCouponReason = $('#sendCouponReason').val();
        console.log(sendReasonDutyDept)
        if (custArea == '' && custName == '' && sendCustType == '' && topicName == '' && sendCouponDept == '' && sendCouponUser == '' &&
            sendCouponReason == '' && inputStarTime == '' && inputEndTime == '' && sendReasonDutyDept == '' && sendCouponType == '' && custType == '') {
            $.Huimodalalert('请至少输入一个值！', 2000);
            $('#putout').removeAttr('href');
            console.log(123);
        }

    }

    function cancel() {
        var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
        parent.layer.close(index);
    }

    //发券原因二级联动

    var oldVal = '';

    function sendDeptChange(Val) {
        if (oldVal != Val) {
            $('#sendCouponReason').val('')
        }
        oldVal = Val;
        console.log(Val);
        var option = document.getElementsByClassName('options');
        console.log(option);
        switch (parseInt(Val)) {
            case 1:
                for (var i = 0; i < option.length; i++) {
                    if (option[i].value == 11 || option[i].value == 12) {
                        console.log(option[i]);
                        option[i].classList.remove('hide');
                    }
                    else {
                        option[i].classList.add('hide');
                    }
                }
                break;
            case 2:
                for (var i = 0; i < option.length; i++) {
                    if (option[i].value > 20 && option[i].value < 28) {
                        console.log(option[i]);
                        option[i].classList.remove('hide');
                    }
                    else {
                        option[i].classList.add('hide');
                    }
                }
                break;
            case 3:
                for (var i = 0; i < option.length; i++) {
                    if (option[i].value > 30 && option[i].value < 35) {
                        console.log(option[i]);
                        option[i].classList.remove('hide');
                    }
                    else {
                        option[i].classList.add('hide');
                    }
                }
                break;
            case 4:
                for (var i = 0; i < option.length; i++) {
                    if (option[i].value > 40 && option[i].value < 49) {
                        console.log(option[i]);
                        option[i].classList.remove('hide');
                    }
                    else {
                        option[i].classList.add('hide');
                    }
                }
                break;
            case 5:
                for (var i = 0; i < option.length; i++) {
                    if (option[i].value > 50 && option[i].value < 59) {
                        console.log(option[i]);
                        option[i].classList.remove('hide');
                    }
                    else {
                        option[i].classList.add('hide');
                    }
                }
                break;
            case 6:
                for (var i = 0; i < option.length; i++) {
                    if (option[i].value > 60 && option[i].value < 69) {
                        console.log(option[i]);
                        option[i].classList.remove('hide');
                    }
                    else {
                        option[i].classList.add('hide');
                    }
                }
                break;
            case 7:
                for (var i = 0; i < option.length; i++) {
                    if (option[i].value > 70 && option[i].value < 79) {
                        console.log(option[i]);
                        option[i].classList.remove('hide');
                    }
                    else {
                        option[i].classList.add('hide');
                    }
                }
                break;
        }
        ;
        download(3);
    }


    // function changeVal(){
    //     sendReasonDutyDept = $('#sendReasonDutyDept').val();
    //     sendCouponReason =  $('#sendCouponReason').val();
    //     download();
    // }
    /*$(function() {
        $('select').comboSelect();
    });
    function selectArea(){
        $.ajax({
            url: root.couponInter.coupon_getCouponInfoExpiredList,
            cache: false,  //禁用缓存
            type: "POST",
            dataType:'json',
            contentType: "application/json",
            data: JSON.stringify({
                "custArea":$('#custArea').val(),

                "custName":$('#custName').val(),

                "topicName":$('#topicName').val(),

                "sendCouponDept":$('#sendCouponDept').val(),

                "sendCouponUser":$('#sendCouponUser').val(),

                "inputStarTime":$('#logmin').val(),

                "inputEndTime":$('#logmax').val(),

                "sendCouponReason":$('#sendCouponReason').val()
            }),
            success: function (data) {
                for(var i in data){
                    $('select').eq(1).append('<option class="option-item option-selected" value="' + data[i].custName + '">' + data[i].custName + '</option>');
                    $('ul').eq(1).append('<li class="option-item option-selected" onclick="toshow(this)" value="' + data[i].custName + '">' + data[i].custName + '</li>');
                }
            },
            error: function () {
            }
    })}
    function toshow(e){
        e.parentElement.nextElementSibling.value=e.innerHTML
    }
    $('#custName').keyup(function(){
    })*/
    /* var flag = true;
     $('#custName').on('compositionstart',function(){
         flag = false;
     })
     $('#custName').on('compositionend',function(){
         flag = true;
     })
     $('#custName').on('input',function(){
         var _this = this;
         setTimeout(function(){
             if(flag){
                 var value=$(_this).val();
                 $('li').remove();
                 $.ajax({
                     url: root.couponInter.coupon_getCouponInfoExpiredList,
                     cache: false,  //禁用缓存
                     type: "POST",
                     dataType:'json',
                     contentType: "application/json",
                     data: JSON.stringify({
                         "custArea":$('#custArea').val(),

                         "custName":$('#custName').val(),

                         "topicName":$('#topicName').val(),

                         "sendCouponDept":$('#sendCouponDept').val(),

                         "sendCouponUser":$('#sendCouponUser').val(),

                         "inputStarTime":$('#logmin').val(),

                         "inputEndTime":$('#logmax').val(),

                         "sendCouponReason":$('#sendCouponReason').val()

                     }),
                     success: function (data) {
                         console.log(data);
                         if(value!='')
                         {   document.getElementById('custList').classList.remove('hide');
                         for(var i in data){
                             $('#custList').append('<li class="customers">' + data[i].custName + '</li>')
                         }
                             $('#custList').comboSelect();
                         }
                         else{
                             document.getElementById('custList').classList.add('hide');
                         }
                         $('.customers').on('click',function () {
                             console.log(this)
                                 $('#custName').val(this.innerHTML);
                                 $('#custList').addClass('hide');
                         })
                     },
                     error: function () {
                     }
                 });
             }
         },0)
     })*/
    /*  function putout(){
             var custArea = $('#custArea').val(),
            custName =  $('#custName').val(),
            topicName = $('#topicName').val(),
            sendCouponDept = $('#sendCouponDept').val(),
            sendCouponUser = $('#sendCouponUser').val(),
            sendCouponReason =  $('#sendCouponReason').val(),
            inputStarTime = $('#logmin').val(),
            inputEndTime = $('#logmax').val();
         if($('#radio-custArea').is(':checked')){
             custArea = '';
             custName = '';
         }
         if($('#radio-couponTopic').is(':checked')){
             topicName = '';
         }
         if($('#radio-sendArea').is(':checked')){
             sendCouponDept = '';
             sendCouponUser = '';
             sendCouponReason = '';
             inputStarTime = '';
             inputEndTime = '';
         }
          console.log(custArea);
          console.log(custName);
          console.log(topicName);
          console.log(sendCouponDept);
          console.log(sendCouponUser);
          console.log(sendCouponReason);
          console.log(inputStarTime);
          console.log(inputEndTime);
          $.ajax({
              // url: root.couponInter.coupon_downloadCouponInfo,
              url:'http://192.168.7.100:8087/info',
              cache: false,  //禁用缓存
              type: "post",
              dataType:'json',
              contentType: "application/json",
              data: JSON.stringify({
                  "custArea":custArea,
                  "custName":custName,
                  // "couponCode":$('#couponCode').val(),
                  // "useStatus":$('#useStatus').val(),
                  // "topicType":$('#topicType').val(),
                  // "topicCode":$('#topicCode').val(),
                  "topicName":topicName,
                  // "orderId":$('#orderId').val(),
                  "sendCouponDept":sendCouponDept,
                  "sendCouponUser":sendCouponUser,
                  "sendCouponReason":sendCouponReason,
                  "inputStarTime":inputStarTime,
                  "inputEndTime":inputEndTime,


              }),
              success: function (data) {
                  console.log(data);
                  // cancel();
              },
              error: function () {
                  $.Huimodalalert('失败！',2000);
              }
          });
      }*/
</script>
</html>